<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${daoUrl}.${entityName}${daoClassNameSuffix}">

<resultMap id="BaseResultMap" type="${entityUrl}.${entityName}">
<#list cis as ci>
    <id column="${ci.column}" property="${ci.property}" />
</#list>
</resultMap>
<sql id="Base_Column_List">
    id, ${agile}
</sql>

<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
    insert into ${table} (
        ${agile}
    )
    values
    <foreach collection="list" item="item" separator=",">
        (${agileValueFields})
    </foreach>
</insert>

<update id="delete">
    update ${table} set is_deleted = 1 , update_id = ${r"#{staffId}"} , update_time = now()
    where record_id = ${r"#{recordId}"} and is_deleted = 0
</update>

<select id="getSubjects" resultMap="BaseResultMap">
    select <include refid="Base_Column_List"/> from ${table}
    where record_id in
    <foreach collection="collection" open="(" close=")" item="i" separator=",">
        ${r"#{i}"}
    </foreach>
    and is_deleted = 0
</select>

</mapper>